<?php include('header.php');?>
<h1 class="pagetitle"><?php include('menu.php');?></h1>
<div id="page">
<!-- start content -->
	<div id="content">
		<form name="frmHomePage" action="" method="POST">
			<table cellspacing="5" cellpadding="5" style="margin-left:-5px;margin-top:-5px;" width="100%" border='0'>
				<TR>
					<td class="headTDleft"  colspan="7">
					<h2>Consolidated Sales Data</h2>
					</td>
				</TR>
				<TR>
					<td>
					<font color="red">
						<ul>
						<?php 
						if(count($errors) > 0){
							foreach($errors as $errorMsg){
								echo '<li>'.$errorMsg.'</li>';
							}
						}
						?>
						</ul>
					</font>
					</td>
				</TR>
				<tr>
				<td width="100%"  colspan="7">
				<table border=0 align="center" width="80%" style="border:1px solid gray" cellspacing="0" cellpadding="10">
					<tr>
					<td class="labeltext">Region</td>
					<td colspan='2'>
						<select id="lstregion" name="lstregion">
							<option value="0">Please Select</option>
							<?php
								if(count($regionList) > 0){
									foreach($regionList as $key=>$value){
										if($regionId == $regionList[$key]['RegionID']){
											$selected = 'selected';
										} else {
											$selected = '';
										}
							?>
							<option value="<?php echo $regionList[$key]['RegionID'];?>" <?php echo $selected;?>><?php echo $regionList[$key]['Name'];?></option>
							<?php 
									}
								}
							?>
						</select>
					</td>
				</tr>
				
				<tr>
					<td class="labeltext">Product</td>
					<td colspan='2'>
						<select id="lstProduct" name="lstProduct">
							<option value="0">Please Select</option>
							<?php
								if(count($productList) > 0){
									foreach($productList as $key=>$value){
									if($productId == $productList[$key]['ProductID']){
										$selected = 'selected';
									} else {
										$selected = '';
									}
							?>
							<option value="<?php echo $productList[$key]['ProductID'];?>" <?php echo $selected;?>><?php echo $productList[$key]['Name'];?></option>
							<?php
									}
								}
							?>
						</select>
					</td>
				</tr>
				<tr>					
					<td class="labeltext"><INPUT TYPE="radio" NAME="rdoGroupFilter" VALUE="year" <?php echo $yearRdo;?>>Years</td>
					<td colspan='2' class="labeltext">
						Start : <select id="listFromYear" name="listFromYear">								
							<?php
								$currYear = date('Y');
								for($i=($currYear-3); $i<=$currYear; $i++){
									$selectedFromYear ="";
									if($i == $fromYear){ $selectedFromYear = 'selected';}		

							?>
							<option value="<?php echo $i;?>" <?php echo $selectedFromYear;?>><?php echo $i;?></option>
							<?php
								}
							?>
						</select>
						<font  class="labeltext">End :</font> <select id="listToYear" name="listToYear">
							<?php
								$currYear = date('Y');
								for($j=($currYear-3); $j<=$currYear; $j++){
									$selectedToYear ="";									
									if($j == $toYear){ $selectedToYear = 'selected';}									

							?>
							<option value="<?php echo $j;?>" <?php echo $selectedToYear;?>><?php echo $j;?></option>
							<?php
								}
							?>
						</select>
					</td>
				</tr>
				<tr>
					<td  valign="top" class="labeltext"><INPUT TYPE="radio" NAME="rdoGroupFilter" VALUE='month' <?php echo $monthRdo;?>>Monthly</td>
					<td  class="labeltext">
						Please Select Year :
						<select id="listYear" name="listYear">
							<?php
								$currYear = date('Y');
								for($k=($currYear-3); $k<=$currYear; $k++){
									$selected ="";									
									if($k == $year){ $selected = 'selected';}
									

							?>
							<option value="<?php echo $k;?>" <?php echo $selected;?>><?php echo $k;?></option>
							<?php
								}
							?>
						</select>
						<!--br><br>
						Please Select Months Start :<select id="lastStartMonth">
							<?php
								for($m=1;$m<=count($months);$m++){
							?>
							<option value="<?php echo $m;?>"><?php echo $months[$m]?></option>
							<?php
								}
							?>
						</select>
						End :<select id="lastEndMonth">
							<?php
								for($n=1;$n<=count($months);$n++){
							?>
							<option value="<?php echo $n;?>"><?php echo $months[$n]?></option>
							<?php
								}
							?>-->
						</select>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td colspan="2" style="margin-right:25px"><INPUT TYPE="SUBMIT" VALUE="Show Graph" ONCLICK="" class="button"></td>
				</tr>
				<tr>
					<td></td>
					<td colspan="2">
						<?php 
							if(count($errors) == 0){
						?>
						<img align="center" src="includes/displayGraph.php">
						<?php 
							}
						?>
					</td>
				</tr>
				</table>
				</td>
				</tr>
			</table>
		</form>
	</div>
	<!-- end content -->
<?php include('auditLog.php');?>
<?php include('footer.php');?>